package com.jm.weibo.ui;

import java.util.ArrayList;
import java.util.List;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.view.Window;
import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;

import com.jm.weibo.logic.MainService;
import com.jm.weibo.logic.WeiboSquareAdapter;

public class SearchActivity extends Activity {
	
	private ListView listView;
    
	private View titleView;
	
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		//取消标题栏
		this.requestWindowFeature(Window.FEATURE_NO_TITLE);
		
		setContentView(R.layout.search);
		
		this.titleView = this.findViewById(R.id.search_title);
		Button btnLeft = (Button) this.titleView.findViewById(R.id.title_bt_left);
		Button btnReght = (Button) this.titleView.findViewById(R.id.title_bt_right);
		TextView tvTitle = (TextView) this.titleView.findViewById(R.id.textView);
		btnLeft.setVisibility(View.GONE);
		btnReght.setVisibility(View.GONE);
		tvTitle.setText(R.string.weibo);
		
		
		List<Integer> list = new ArrayList<Integer>();
		list.add(R.string.hotTopic);
		list.add(R.string.hotRepost);
		list.add(R.string.hotComment);
		list.add(R.string.scan);
		
		this.listView = (ListView) this.findViewById(R.id.LvSquare);
		this.listView.setAdapter(new WeiboSquareAdapter(this, list));
	}


	public boolean onKeyDown(int keyCode, KeyEvent event) {
		Log.d("keydown", ".................." + keyCode);
		if (keyCode == 4)// 如果用户按下了返回键
		{
			MainService.promptExitApp(this);
		}
		return true;
	}
}
